import { post } from '@/utils/request.js'

// 框选擦除
export const eraseWithBox = async (imageBase64, coordinates, isText = true) => {
    const requestData = {
        parameter: {
            rsp_media_type: "url",
            userboxes: JSON.stringify(coordinates),
            is_text: isText
        },
        media_info_list: [{
            media_data: imageBase64,
            media_extra: {},
            media_profiles: {
                media_data_type: "jpg"
            }
        }]
    }
    
    return await post({
        url: '/api/watermark-removal/eraseWithBox',
        data: requestData
    })
}

// 涂抹擦除
export const eraseWithMask = async (originalImage, maskImage) => {
    const requestData = {
        parameter: {
            rsp_media_type: "url"
        },
        media_info_list: [
            {
                media_data: originalImage,
                media_extra: {},
                media_profiles: {
                    media_data_type: "jpg"
                }
            },
            {
                media_data: maskImage,
                media_extra: {},
                media_profiles: {
                    media_data_type: "png"
                }
            }
        ]
    }
    
    return await post({
        url: '/api/watermark-removal/eraseWithMask',
        data: requestData
    })
}

// 发送反馈邮件
export const sendFeedbackEmail = async (formData) => {
    return await post({
        url: '/api/mail/send-with-attachment',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}